import $api from '@/ulm/api';
import $router from '@/ulm/router';
import $helper from '@/ulm/helper';
import $store from '@/ulm/store';
import wechat from '@/ulm/wechat/wechat';
import utils from './utils';

const ulm = {
  $api,
  $store,
  $router,
  $helper
};

/** 加载uLm底层依赖 */
export async function LmInit () {
  if (process.env.NODE_ENV === 'development') {
    LmDebug();
  }
  // #ifdef MP-WEIXIN
  // 检测小程序更新
  wechat.checkMiniProgramUpdate();
  // #endif

}

/** 开发模式 */
function LmDebug () {
  // 开发环境引入vconsole调试
  // #ifdef H5
  // import("vconsole").then(vconsole => {
  // 	new vconsole.default();
  // });
  // #endif
}

const $ulm = {
	...utils,
	...$router
}

uni.$ulm = $ulm

export {
	$api,
	$store,
	$router,
	$helper
}
export const install = (Vue,options={}) => {
	// #ifdef VUE2
	Vue.prototype.$ulm = $ulm;
	// #endif
	
	// #ifdef VUE3
	Vue.config.globalProperties.$ulm = $ulm;
	// #endif
}

export default ulm